from rest_framework import serializers

from . import models


class BannerSerializer(serializers.ModelSerializer):
    class Meta:
        model = models.Banner
        fields = ['title', 'link', 'image']


class SwimmingSerializer(serializers.ModelSerializer):
    class Meta:
        model = models.SwimmingsInfo
        fields = ['name', 'info', 'capacity', 'state', ]
        extra_kwargs = {
            'name': {'read_only': True},
            'info': {'read_only': True},
            'capacity': {'read_only': True},
            'state': {'read_only': True}
        }


class SwimnumSerializer(serializers.ModelSerializer):
    class Meta:
        model = models.Swimnum
        fields = ['id', 'num','total']


class SwimPeopleNumSerializer(serializers.ModelSerializer):
    class Meta:
        model = models.SwimPeopleNum
        fields = ['num', 'date']
